<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  <script>
  //1.使用对象字面量表示法构建对象
	var student={
		name:"zhangsan",
		stuNO:"202101501",
		stuClass:"21级计算机应用技术班",
		study:function(){
			document.write( this.name +" "+"正在学习JavaScript!" +"</br>");
		},
		sport:function(){
			document.write(this.name +" "+"学习完后去打篮球!"+"</br>");
		}
	}
	document.write("姓名:"+student.name+"</br>" );
	document.write("学号:"+student.stuNO+"</br>");
	document.write("班级:"+student.stuClass+" </br>");
	student.study( );
	student.sport( );
	//2.使用构造函数模式构建对象
	function Student(name,stuNO,stuClass){
		this.name=name;
		this.stuNO=stuNO;
		this.stuClass=stuClass;
		this.study=function(study){
			document.write( this.name +" "+"正在学习" +study+" </br>" );
		};
		this.sport=function(sport){
			document.write( this.name +" "+"学习完后去" +sport+"</br>");
		};
	}
	var stu1=new Student("zhangsan","202101501","21 级计算机应用技术班");
	var stu2=new Student("lisi","202101502","21 级计算机应用技术班");
	document.write("</br>");
	document.write("姓名:"+stu1.name+"</br>");
	document.write("学号:"+stu1.stuNO+"</br>");
	document.write("班级:"+stu1.stuClass+"</br>");
	stu1.study("JavaScript");
	stu1.sport("打篮球");
	document.write("</br>");
	document.write("姓名:"+stu2.name+"</br>");
	document.write("学号:"+stu2.stuNO+"</br>");
	document.write ("班级:"+stu2.stuClass+"</br>");
	stu2.study("Java");
	stu2.sport("踢足球");
  </script>
 </body>
</html>
